1   // Copyright 2008, 2009 The Apache Software Foundation
2   //
3   // Licensed under the Apache License, Version 2.0 (the "License");
4   // you may not use this file except in compliance with the License.
5   // You may obtain a copy of the License at
6   //
7   //     http://www.apache.org/licenses/LICENSE-2.0
8   //
9   // Unless required by applicable law or agreed to in writing, software
10  // distributed under the License is distributed on an "AS IS" BASIS,
11  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  // See the License for the specific language governing permissions and
13  // limitations under the License.
14  
15  package org.apache.tapestry5.internal.pageload;
16  
17  import org.apache.tapestry5.MarkupWriter;
18  import org.apache.tapestry5.internal.test.InternalBaseTestCase;
19  import org.apache.tapestry5.runtime.RenderCommand;
20  import org.apache.tapestry5.runtime.RenderQueue;
21  import org.testng.annotations.DataProvider;
22  import org.testng.annotations.Test;
23  
24  public class CompositeRenderCommandTest extends InternalBaseTestCase
25  {
26      @DataProvider
27      public Object[][] nyi_data()
28      {
29          RenderCommand push = new RenderCommand()
30          {
31              public void render(MarkupWriter writer, RenderQueue queue)
32              {
33                  queue.push(null);
34              }
35          };
36  
37          RenderCommand startComponent = new RenderCommand()
38          {
39              public void render(MarkupWriter writer, RenderQueue queue)
40              {
41                  queue.startComponent(null);
42              }
43          };
44  
45          RenderCommand endComponent = new RenderCommand()
46          {
47              public void render(MarkupWriter writer, RenderQueue queue)
48              {
49                  queue.endComponent();
50              }
51          };
52  
53  
54          return new Object[][] {
55                  {
56                          push
57                  },
58                  {
59                          startComponent
60                  },
61                  {
62                          endComponent
63                  }
64          };
65      }
66  
67      @Test(dataProvider = "nyi_data")
68      public void render_queue_commands_nyi
69              (RenderCommand
70                      rc)
71      {
72          MarkupWriter writer = mockMarkupWriter();
73          RenderQueue queue = mockRenderQueue();
74  
75          try
76          {
77              new CompositeRenderCommand(new RenderCommand[] { rc }).render(writer, queue);
78  
79              unreachable();
80          }
81          catch (IllegalStateException ex)
82          {
83              // Don't care about the message.
84          }
85      }
86  }